package cate.game.play.buff.h;

import cate.common.util.XT;
import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.util.FighterFilter;

import java.util.List;

/**
 * 若目标处于【流血】则回复自身本次伤害的60%生命值
 */
public class 技能吸血BH extends BuffHandler {

	private PlayCfgArgs args;

	private List<String> 技能标签;

	private double 系数;

	//技能标签=？？&系数=6000
	@Override
	public void parse(String code) {
		args = new PlayCfgArgs(code);
		技能标签 = args.getStrList("技能标签");
		系数 = args.getWDouble("系数", 0d);
	}

	@Override
	public void afterOneAttack(SkillActionCtx action, byte nature, long totalDamage, boolean strike, Fighter target) {
		if (XT.isNotBlank(技能标签) && !action.getSkill().cfg.containTags(技能标签)) {
			return;
		}
		if(FighterFilter.test(args, buff.owner, target)){
			buff.owner.attr.passiveHeal(action, buff.owner, totalDamage * 系数);
		}
	}
}
